#include <stdio.h>

void Move(char src, char dest, int plate)
{
    printf("%d:%c->%c\n", plate, src, dest);
}

void Plate_Move(int n, char source, char auxiliary, char target)
{
    if (n == 1)
    {
        Move(source, target, 1);
    }
    else
    {
        Plate_Move(n - 1, source, target, auxiliary);
        
        Move(source, target, n);
        
        Plate_Move(n - 1, auxiliary, source, target);
        
    }
}

int main()
{
    int n = 0;
    scanf("%d", &n);
	char a, b, c;
	scanf("%c %c %c", &a, &b, &c);
    Plate_Move(n, 'a', 'b', 'c');

    return 0;
}

